package com.ymatou.iapi.productquery.testcase;

import com.ymatou.iapi.productquery.parameter.GetMongoBean;
import com.ymatou.iapi.productquery.service.GetMongoCall;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;

import java.util.Arrays;

/**
*从mongo里获取时间戳
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetMongo{
	private static GetMongoBean getmongoBean;
	private static GetMongoCall getmongoCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("从mongo里获取时间戳");
	}

	@Before
	public void caseUp() {
		getmongoBean=new GetMongoBean();
		getmongoCall=new GetMongoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getmongoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetMongo_01() {
		Logger.start(true,"从mongo里获取时间戳");
		try {
			//根据商品id从mongo中获取时间戳  测试性能
			getmongoBean.setProductIdList(Arrays.asList("7f933d04-1128-4ed2-8b23-7e097806a5d4","d0c26e41-cef8-4122-95fb-b52c719b1002"));
			getmongoCall.setData(getmongoBean);
			getmongoCall.callService();			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}